home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / MachineExceptions.h < prev    next >
Text File  |  1995-07-06  |  6KB  |  198 lines

  1. /*
  2.      File:        MachineExceptions.h
  3.  
  4.      Contains:    Processor Exception Handling Interfaces .
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __MACHINEEXCEPTIONS__
  21. #define __MACHINEEXCEPTIONS__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. #if PRAGMA_ALIGN_SUPPORTED
  34. #pragma options align=power
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT_SUPPORTED
  38. #pragma import on
  39. #endif
  40.  
  41. typedef KernelID AreaID;
  42.  
  43. /* Machine Dependent types for PowerPC: */
  44. struct MachineInformationPowerPC {
  45.     UnsignedWide                    CTR;
  46.     UnsignedWide                    LR;
  47.     UnsignedWide                    PC;
  48.     unsigned long                    CR;
  49.     unsigned long                    XER;
  50.     unsigned long                    MSR;
  51. };
  52. typedef struct MachineInformationPowerPC MachineInformationPowerPC;
  53.  
  54. struct RegisterInformationPowerPC {
  55.     UnsignedWide                    R0;
  56.     UnsignedWide                    R1;
  57.     UnsignedWide                    R2;
  58.     UnsignedWide                    R3;
  59.     UnsignedWide                    R4;
  60.     UnsignedWide                    R5;
  61.     UnsignedWide                    R6;
  62.     UnsignedWide                    R7;
  63.     UnsignedWide                    R8;
  64.     UnsignedWide                    R9;
  65.     UnsignedWide                    R10;
  66.     UnsignedWide                    R11;
  67.     UnsignedWide                    R12;
  68.     UnsignedWide                    R13;
  69.     UnsignedWide                    R14;
  70.     UnsignedWide                    R15;
  71.     UnsignedWide                    R16;
  72.     UnsignedWide                    R17;
  73.     UnsignedWide                    R18;
  74.     UnsignedWide                    R19;
  75.     UnsignedWide                    R20;
  76.     UnsignedWide                    R21;
  77.     UnsignedWide                    R22;
  78.     UnsignedWide                    R23;
  79.     UnsignedWide                    R24;
  80.     UnsignedWide                    R25;
  81.     UnsignedWide                    R26;
  82.     UnsignedWide                    R27;
  83.     UnsignedWide                    R28;
  84.     UnsignedWide                    R29;
  85.     UnsignedWide                    R30;
  86.     UnsignedWide                    R31;
  87. };
  88. typedef struct RegisterInformationPowerPC RegisterInformationPowerPC;
  89.  
  90. struct FPUInformationPowerPC {
  91.     UnsignedWide                    Registers[32];
  92.     unsigned long                    FPSCR;
  93.     unsigned long                    Reserved;
  94. };
  95. typedef struct FPUInformationPowerPC FPUInformationPowerPC;
  96.  
  97.  
  98. enum {
  99.     kWriteReference                = 0,
  100.     kReadReference                = 1,
  101.     kFetchReference                = 2,
  102.     writeReference                = kWriteReference,                /* Obsolete name*/
  103.     readReference                = kReadReference,                /* Obsolete name*/
  104.     fetchReference                = kFetchReference                /* Obsolete name*/
  105. };
  106.  
  107. typedef unsigned long MemoryReferenceKind;
  108.  
  109. struct MemoryExceptionInformation {
  110.     AreaID                            theArea;
  111.     LogicalAddress                    theAddress;
  112.     OSStatus                        theError;
  113.     MemoryReferenceKind                theReference;
  114. };
  115. typedef struct MemoryExceptionInformation MemoryExceptionInformation;
  116.  
  117.  
  118. enum {
  119.     kUnknownException            = 0,
  120.     kIllegalInstructionException = 1,
  121.     kTrapException                = 2,
  122.     kAccessException            = 3,
  123.     kUnmappedMemoryException    = 4,
  124.     kExcludedMemoryException    = 5,
  125.     kReadOnlyMemoryException    = 6,
  126.     kUnresolvablePageFaultException = 7,
  127.     kPrivilegeViolationException = 8,
  128.     kTraceException                = 9,
  129.     kInstructionBreakpointException = 10,
  130.     kDataBreakpointException    = 11,
  131.     kIntegerException            = 12,
  132.     kFloatingPointException        = 13,
  133.     kStackOverflowException        = 14,
  134.     kTerminationException        = 15,
  135.     unknownException            = kUnknownException,            /* Obsolete name*/
  136.     illegalInstructionException    = kIllegalInstructionException,    /* Obsolete name*/
  137.     trapException                = kTrapException,                /* Obsolete name*/
  138.     accessException                = kAccessException,                /* Obsolete name*/
  139.     unmappedMemoryException        = kUnmappedMemoryException,        /* Obsolete name*/
  140.     excludedMemoryException        = kExcludedMemoryException,        /* Obsolete name*/
  141.     readOnlyMemoryException        = kReadOnlyMemoryException,        /* Obsolete name*/
  142.     unresolvablePageFaultException = kUnresolvablePageFaultException, /* Obsolete name*/
  143.     privilegeViolationException    = kPrivilegeViolationException,    /* Obsolete name*/
  144.     traceException                = kTraceException,                /* Obsolete name*/
  145.     instructionBreakpointException = kInstructionBreakpointException, /* Obsolete name*/
  146.     dataBreakpointException        = kDataBreakpointException,        /* Obsolete name*/
  147.     integerException            = kIntegerException,            /* Obsolete name*/
  148.     floatingPointException        = kFloatingPointException,        /* Obsolete name*/
  149.     stackOverflowException        = kStackOverflowException,        /* Obsolete name*/
  150.     terminationException        = kTerminationException            /* Obsolete name*/
  151. };
  152.  
  153. typedef unsigned long ExceptionKind;
  154.  
  155. union ExceptionInfo {
  156.     MemoryExceptionInformation        *memoryInfo;
  157. };
  158. typedef union ExceptionInfo ExceptionInfo;
  159.  
  160. struct ExceptionInformationPowerPC {
  161.     ExceptionKind                    theKind;
  162.     MachineInformationPowerPC        *machineState;
  163.     RegisterInformationPowerPC        *registerImage;
  164.     FPUInformationPowerPC            *FPUImage;
  165.     ExceptionInfo                    info;
  166. };
  167. typedef struct ExceptionInformationPowerPC ExceptionInformationPowerPC;
  168.  
  169. #if GENERATINGPOWERPC
  170. typedef ExceptionInformationPowerPC ExceptionInformation;
  171.  
  172. typedef MachineInformationPowerPC MachineInformation;
  173.  
  174. typedef RegisterInformationPowerPC RegisterInformation;
  175.  
  176. typedef FPUInformationPowerPC FPUInformation;
  177.  
  178. #endif
  179. /* Note:    An ExceptionHandler is NOT a UniversalProcPtr.
  180.             It must be a native function pointer with NO routine descriptor. */
  181. typedef OSStatus (*ExceptionHandler)(ExceptionInformationPowerPC *theException);
  182. /* Routine for installing per-process exception handlers */
  183. extern pascal ExceptionHandler InstallExceptionHandler(ExceptionHandler theHandler);
  184.  
  185. #if PRAGMA_IMPORT_SUPPORTED
  186. #pragma import off
  187. #endif
  188.  
  189. #if PRAGMA_ALIGN_SUPPORTED
  190. #pragma options align=reset
  191. #endif
  192.  
  193. #ifdef __cplusplus
  194. }
  195. #endif
  196.  
  197. #endif /* __MACHINEEXCEPTIONS__ */
  198.